package wwl.lsf.kafka;

import java.util.UUID;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@EnableScheduling
@Component
@Slf4j
public class MsgProducer {

  @Autowired
  private KafkaTemplate kafkaTemplate;

  @Scheduled(cron = "0/20 * * * * ? ")
  public void send() {
    System.out.println("send");
    kafkaTemplate.send("hello", UUID.randomUUID().toString());
  }

  @Scheduled(cron = "0/5 * * * * ? ")
  public void sendHello3333() {
    System.out.println("sendHello3333");
    kafkaTemplate.send("hello3333", UUID.randomUUID().toString());
  }


}
